<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="Order.OrderDeal"%>
<%@page import="java.sql.Date"%>
<%@page import="java.util.*" %>
<%
String OrderInf=null;
String OrderNum=null;
OrderNum=request.getParameter("OrderNum");
OrderInf=request.getParameter("OrderInf");
int K=0;
try{
K=Integer.parseInt(OrderNum);
}catch(Exception e){
e.printStackTrace();
}
//需要先实例化对象

OrderDeal Order=new OrderDeal();
String OrderID=Order.CalOrderID();
String OrTime=Order.OrTime;
Order.setOrderID(OrderID);
Order.setBuyerID((String)session.getAttribute("id"));
Order.setSellerID((String)session.getAttribute("SellerID"));
Order.setComID((String)session.getAttribute("ComID"));
Order.setComName((String)session.getAttribute("ComName"));
Order.setOrderNum(K);
Order.setOrderTime(OrTime);
float Price=(float)Order.CalPrice(K,Order.getComID());
Order.setOrderPrice(Price);
Order.setOrderToDate(2);
Order.setOrderIsChecked(0);
Order.setOrderInf(OrderInf);
%>
<html>
  <head>
    <title>预定跳转页面</title>
  </head>
  <body>
  <%
   if(Order.AddOrder(Order.getOrderID(),Order.getBuyerID(),Order.getSellerID(),Order.getComID(),Order.getComName(),Order.getOrderNum(),Order.getOrderPrice(),Order.getOrderTime(),Order.getOrderToDate(),Order.getOrderIsChecked(),Order.getOrderInf())==0)
	{
    
	   out.print("<script>alert('提交订单失败，请重新尝试  ')</script>");
    }
    else
    {
       String ou=""+Order.getOrderTime()+"提交订单成功！订单编号为" +Order.getOrderID();
	   out.print("<script>alert('"+Order.getOrderTime()+"提交订单成功！订单编号为"+Order.getOrderID()+"')</script>");
	   
    }
    %>
  	 <script type="text/javascript">

        window.location.href="../Order/Order.jsp";    

   </script>
  </body>
</html>
